<template>
  <el-tooltip :disabled="!tooltip" :content="tooltip">
    <svg class="icon" :class="className" aria-hidden="true">
      <use :xlink:href="`#icon-${iconName}`"></use>
    </svg>
  </el-tooltip>
</template>

<script>
export default {
  name: 'SvgIcon', // icon 组件
  props: {
    iconName: { // 图标的文件名
      type: String,
      required: true,
    },
    className: { // 更多样式
      type: String,
      required: false,
    },
    tooltip: { // tooltip
      type: String,
      required: false,
    },
  },
};
</script>

<style lang="scss">
.icon {
  width: 1em;
  height: 1em;
  vertical-align: -.10rem;
  fill: currentColor;
  overflow: hidden;
}
</style>
